package com.cxc.demo.mapper;

import com.cxc.demo.dto.Person;
import com.cxc.demo.dto.PersonDTO;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;


@Mapper
public interface PersonMapper {

    PersonMapper INSTANCT = Mappers.getMapper(PersonMapper.class);
    @Mapping(target="personName",source="name")
    @Mapping(target="id" , ignore = true) //忽略id，不进行映射
    @Mapping(target="describe" , source = "describe",defaultValue = "默认值") //忽略id，不进行映射
    @Mapping(target = "createTime",dateFormat = "yyyy-MM-dd")//,expression = "java(new java.util.Date())"
    PersonDTO conver(Person person);



}
